package com.hhs.storage.controller;


import com.hhs.storage.bean.InputParam;
import com.hhs.storage.bean.Notice;
import com.hhs.storage.service.NoticeService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hhs
 * @since 2023-04-13
 */
@RestController
@RequestMapping("/notice")
public class NoticeController {
    @Resource
    private NoticeService noticeService;
    @RequestMapping(value = "table")
    public Map<String, Object> getAll(Notice notice, InputParam inputParam) {
        return noticeService.getAll(notice,inputParam);
    }
    /**
     * 根据部门id获取公告
     * @param departId
     * @param inputParam
     * @return
     */
    @RequestMapping(value = "getNoticeByDepartId")
    public Map<String, Object> getNoticeByDepartId(@RequestParam String departId, InputParam inputParam) {
        return noticeService.getNoticeByDepartId(departId,inputParam);
    }
    @PostMapping(value = "edit")
    public Map<String, Object> addOrUpdate(Notice notice,String deleImgStr){
        return noticeService.addOrUpdate(notice,deleImgStr);
    }
    @RequestMapping(value = "dele")
    public Map<String, Object> dele(@RequestParam String id) {
            return noticeService.dele(id);
    }
}

